package cn.edu.jxust.common.domain.web.api.air;

import cn.edu.jxust.common.response.Result;
import cn.edu.jxust.core.infrastructure.util.Const;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author QiuKangming
 * @version 1.0
 * @description
 * @since 2020/09/15 14:35
 */
@RequestMapping("/api/air")
public interface IAirController {

    /**
     * 获取大气污染物分担率: 即查询时间内每种气体得浓度平均值
     * @param deviceId 设备id号
     * @param beginDate 开始时间
     * @param endDate 结束时间
     * @return Result
     */
    @GetMapping
    @RequiresPermissions("air:pollution")
    Result getPollutionShareRate(@RequestParam(name = "deviceId") Integer deviceId,
                                        @RequestParam(name = "beginDate") String beginDate,
                                        @RequestParam(name = "endDate") String endDate);

    /**
     * 获取首要污染物天数构成
     * @param deviceId 设备id号
     * @param beginDate 开始时间
     * @param endDate 结束时间
     * @return Result
     */
    @GetMapping("/mainair")
    @RequiresPermissions("air:pollution_important")
    Result getMainPollutionDays(@RequestParam(name = "deviceId") Integer deviceId,
                                @RequestParam(name = "beginDate") String beginDate,
                                @RequestParam(name = "endDate") String endDate);

    /**
     * 分页获取有问题的Air数据
     * @param page 第几页
     * @param size 一页几条数据
     * @param deviceId 设备id号，为空则查询所有设备
     * @param airType 气体类型， 为空则查询所有气体信息
     * @param beginDate 开始时间，
     * @param endDate 结束时间
     * @return Result
     */
    @GetMapping("/badair")
    @RequiresPermissions("air:badair")
    Result getHasExceptionAir(@RequestParam(name = "page", defaultValue = Const.DEFAULT_PAGE_NUMBER) Integer page,
                              @RequestParam(name = "size", defaultValue = Const.DEFAULT_PAGE_SIZE) Integer size,
                              @RequestParam(name = "deviceId") Integer deviceId,
                              @RequestParam(name = "airType", required = false) Integer airType,
                              @RequestParam(name = "beginDate") String beginDate,
                              @RequestParam(name = "endDate") String endDate);


}
